import type { OrderLogisticResult, OrderResult } from '@/types/order'
import { http } from '@/utils/http'

/* 获取微信支付参数
GET/pay/wxPay/miniPay */
export const getPayWxPayMiniPayAPI = (data: { orderId: string }) => {
  return http<WechatMiniprogram.RequestPaymentOption>({
    method: 'GET',
    url: '/pay/wxPay/miniPay',
    data,
  })
}
/* 模拟支付-内测版
GET/pay/mock
在 DEV 环境中使用，模拟支付，更新订单状态为待发货。 */
export const getPayMockAPI = (data: { orderId: string }) => {
  return http({
    method: 'GET',
    url: '/pay/mock',
    data,
  })
}
/* 模拟发货-内测版
GET/member/order/consignment/{id}
开发中 */
export const getOrderConsignmentAPI = (id: string) => {
  return http({
    method: 'GET',
    url: `/member/order/consignment/${id}`,
  })
}
/* 确认收货
PUT/member/order/{id}/receipt */
export const OrderReceiptAPI = (id: string) => {
  return http<OrderResult>({
    method: 'PUT',
    url: `/member/order/${id}/receipt`,
  })
}
/* 获取订单物流
GET/member/order/{id}/logistics
开发中 */
export const getMemberOrderLogisticsByIdAPI = (id: string) => {
  return http<OrderLogisticResult>({
    method: 'GET',
    url: `/member/order/${id}/logistics`,
  })
}
/* 删除订单
DELETE/member/order
开发中 */
export const deleteMemberOrderAPI = (data: { ids: string[] }) => {
  return http({
    method: 'DELETE',
    url: '/member/order',
    data,
  })
}
